
import time 
from Brain.sensors.encoder import Encoder

class EncoderTest:
	def __init__(self, encoder):
		self.encoder = encoder
	
	def run(self):
		print 'testing communication ..'
		begin = time.time()
		#while time.time() - begin < 3.0 :
		#	time.sleep(0.1)
		
		#self.encoder._isr = original 
		#print 'dump calculation data :'
		
		for x in range(20):
			time.sleep(0.1)
			print self.encoder.read()
		

if __name__ == '__main__':
	device = Encoder()
	device.setDaemon(True)
	device.start()
	test = EncoderTest( device )
	test.run()
	print 'encoder test done.'






